var yddfProUrl = "http://mpservice.ceair.com/mpservice/"; 

var DATE=''; //格式xxxx-xx-xx
var DATE2=''; //格式xxxx/xx/xx
var ap=getLocVal("airportCode");
var AIRPORT=ap==''?'sha':ap;
var TYPE='';
getTime();  //test

/**
 * 获取时间：年-月-日
 */
function getTime()
{
    var d = new Date();
    var vYear = d.getFullYear();
    var m=d.getMonth() + 1;
    var vMon =m>=10?m: "0"+m;
    var day=d.getDate();
    var vDay =day>=10?day: "0"+day;
    DATE=vYear+"-"+vMon+"-"+vDay;
    DATE2=vYear+"/"+vMon+"/"+vDay;
}

//关闭窗口
function winClose(n) {
    uexWindow.close(n);
}

/*浮动窗口执行JS脚本*/
function ueppscript(wn, pn, scr) {
    uexWindow.evaluatePopoverScript(wn, pn, scr);
}

/**
 * @param String inWndName 新窗口名称
 * @param String html       新窗口路径
 * @param String inAniID    打开动画
 * @param String f
 */
function openNewWin(inWndName,html,inAniID,f){
    if(inAniID)
        uexWindow.open(inWndName,'0',html,inAniID,'','',(f)?f:0);
    else
        uexWindow.open(inWndName,'0',html,2,'','',(f)?f:0);
}
/**
 * 判断是否是空
 * @param value
 */
function isDefine(value){
    if(value == null || value == "" || value == "undefined" || value == undefined || value == "null" || value == "(null)" || value == 'NULL' || typeof(value) == 'undefined'){
        return false;
    }
    else{
        return true;
    }
}
/**
 * localStorage保存数据
 * @param String key  保存数据的key值
 * @param String value  保存的数据
 */
function setLocVal(key,value){
    window.localStorage[key] = value;
}
/**
 * 根据key取localStorage的值
 * @param Stirng key 保存的key值
 */
function getLocVal(key){
    if(window.localStorage[key])
        return window.localStorage[key];
    else
        return "";
}
/**
 * 设置平台弹动效果
 * @param int sta   0=无弹动效果   1=默认弹动效果  2=设置图片弹动
 * @param Function downcb 下拉
 * @param Function upcb   上拖
 */
function setPageBounce(sta, downcb, upcb){
    if(sta == 0) return;
    var color = "#FFF";
    if(sta == 1){
        var s = ['0', '0'];
        var str = '';
        uexWindow.onBounceStateChange = function (type,status){
            if(downcb && type==0 && status==2) downcb();
            if(upcb && type==1 && status==2) upcb();
        }
        
        uexWindow.setBounce("1");
        
        if(downcb){
            s[0] = '1';
            uexWindow.notifyBounceEvent("0","1");
        }
        if(color){
            uexWindow.showBounceView("0",color,s[0]);
        }else{
            uexWindow.showBounceView("0","rgba(255,255,255,0)",s[0]);
        }
        
        
        if(upcb){
            s[1] = '1';
            uexWindow.notifyBounceEvent("1","1");
        }
        if(color){
            uexWindow.showBounceView("1",color,s[1]);
        }else{
            uexWindow.showBounceView("1","rgba(255,255,255,0)",s[1]);
        }
    //  uexWindow.showBounceView("1","rgba(255,255,255,0)",s[1]);
    }
    if(sta == 2){
        uexWindow.onBounceStateChange = function (type,status){
            //uexWindow.toast("0", "", type+"|"+status, 1500);
            //uexLog.sendLog("type="+type+"||status="+status);
            if(downcb && type==0 && status==2) downcb();
            if(upcb && type==1 && status==2) upcb();
        }
        uexWindow.setBounce("1");
        
        var inJson ='{"imagePath":"res://reload.png","textColor":"#530606","pullToReloadText":"拖动刷新","releaseToReloadText":"释放刷新","loadingText":"加载中，请稍等","loadingImagePath":"res://shuaxin.png"}'
        if(downcb){
            uexWindow.setBounceParams('0',inJson,"donghang");
            uexWindow.showBounceView('0',color,1);
            uexWindow.notifyBounceEvent('0',1); 
        }
        if(upcb){
            uexWindow.setBounceParams('1',inJson,"donghang")
            uexWindow.showBounceView('1',color,1);
            uexWindow.notifyBounceEvent('1',1);
        }
    }
}

/***
 * 使弹动重置为初始位置
 * @param String type 弹动的类型 0-顶部弹动  1-底部弹动 
 */
function resetBV(type){
    uexWindow.resetBounceView(type);
}